﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="RRExtDocumentDataRequest", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest))]
    public class RRExtDocumentDataRequestSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IRRExtDocumentDataRequest clazz;
        
        public RRExtDocumentDataRequestSerializer(IRRExtDocumentDataRequest clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("Tegevus");
            if (clazz.Tegevus!=null) {
                Writer.WriteTypeAttribute("http://producers.rr.xtee.riik.ee/producer/rr", ">>RRExtDocumentDataRequest>Tegevus");
                Writer.WriteString(clazz.Tegevus.ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Tegevus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Dokument");
            if (clazz.Dokument!=null) {
                global::Xtee.Core.SerializationMetadata metaDokument = this.GetMetaData(clazz.Dokument);
                Writer.WriteTypeAttribute(metaDokument.TypeQualifiedName.Namespace, metaDokument.TypeQualifiedName.Name);
                metaDokument.NewSerializer(clazz.Dokument).WriteXml(Writer);
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Dokument");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Isikud");
            if (clazz.Isikud!=null) {
                global::Xtee.Core.SerializationMetadata metaIsikud = this.GetMetaData(clazz.Isikud);
                Writer.WriteTypeAttribute(metaIsikud.TypeQualifiedName.Namespace, metaIsikud.TypeQualifiedName.Name);
                metaIsikud.NewSerializer(clazz.Isikud).WriteXml(Writer);
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikud");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Elukoht");
            if (clazz.Elukoht!=null) {
                global::Xtee.Core.SerializationMetadata metaElukoht = this.GetMetaData(clazz.Elukoht);
                Writer.WriteTypeAttribute(metaElukoht.TypeQualifiedName.Namespace, metaElukoht.TypeQualifiedName.Name);
                metaElukoht.NewSerializer(clazz.Elukoht).WriteXml(Writer);
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Elukoht");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("EestiElukoht");
            if (clazz.EestiElukoht!=null) {
                global::Xtee.Core.SerializationMetadata metaEestiElukoht = this.GetMetaData(clazz.EestiElukoht);
                Writer.WriteTypeAttribute(metaEestiElukoht.TypeQualifiedName.Namespace, metaEestiElukoht.TypeQualifiedName.Name);
                metaEestiElukoht.NewSerializer(clazz.EestiElukoht).WriteXml(Writer);
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EestiElukoht");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Sideandmed");
            if (clazz.Sideandmed!=null) {
                global::Xtee.Core.SerializationMetadata metaSideandmed = this.GetMetaData(clazz.Sideandmed);
                Writer.WriteTypeAttribute(metaSideandmed.TypeQualifiedName.Namespace, metaSideandmed.TypeQualifiedName.Name);
                metaSideandmed.NewSerializer(clazz.Sideandmed).WriteXml(Writer);
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Sideandmed");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Avaldaja");
            if (clazz.Avaldaja!=null) {
                global::Xtee.Core.SerializationMetadata metaAvaldaja = this.GetMetaData(clazz.Avaldaja);
                Writer.WriteTypeAttribute(metaAvaldaja.TypeQualifiedName.Namespace, metaAvaldaja.TypeQualifiedName.Name);
                metaAvaldaja.NewSerializer(clazz.Avaldaja).WriteXml(Writer);
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Avaldaja");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="Tegevus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRExtDocumentDataRequest>Tegevus");
                }
                clazz.Tegevus = new RRExtDocumentDataRequest.TegevusType(Reader.ReadElementString("Tegevus"));
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRExtDocumentDataRequest>Tegevus", Reader.LocalName);
            }
            if (Reader.LocalName=="Dokument") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRExtDocumentDataRequest>Dokument");
                }
                global::Xtee.Core.SerializationMetadata metaDokument = this.GetMetaData<RRExtDocumentDataRequest.IDokumentType>(Reader, ">>RRExtDocumentDataRequest>Dokument", "http://producers.rr.xtee.riik.ee/producer/rr");
                clazz.Dokument = metaDokument.NewEntity<RRExtDocumentDataRequest.IDokumentType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Dokument");
                    metaDokument.NewSerializer(clazz.Dokument).ReadXml(Reader);
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRExtDocumentDataRequest>Dokument", Reader.LocalName);
            }
            if (Reader.LocalName=="Isikud") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRExtDocumentDataRequest>Isikud");
                }
                global::Xtee.Core.SerializationMetadata metaIsikud = this.GetMetaData<RRExtDocumentDataRequest.IIsikudType>(Reader, ">>RRExtDocumentDataRequest>Isikud", "http://producers.rr.xtee.riik.ee/producer/rr");
                clazz.Isikud = metaIsikud.NewEntity<RRExtDocumentDataRequest.IIsikudType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Isikud");
                    metaIsikud.NewSerializer(clazz.Isikud).ReadXml(Reader);
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRExtDocumentDataRequest>Isikud", Reader.LocalName);
            }
            if (Reader.LocalName=="Elukoht") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRExtDocumentDataRequest>Elukoht");
                }
                global::Xtee.Core.SerializationMetadata metaElukoht = this.GetMetaData<RRExtDocumentDataRequest.IElukohtType>(Reader, ">>RRExtDocumentDataRequest>Elukoht", "http://producers.rr.xtee.riik.ee/producer/rr");
                clazz.Elukoht = metaElukoht.NewEntity<RRExtDocumentDataRequest.IElukohtType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Elukoht");
                    metaElukoht.NewSerializer(clazz.Elukoht).ReadXml(Reader);
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRExtDocumentDataRequest>Elukoht", Reader.LocalName);
            }
            if (Reader.LocalName=="EestiElukoht") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRExtDocumentDataRequest>EestiElukoht");
                }
                global::Xtee.Core.SerializationMetadata metaEestiElukoht = this.GetMetaData<RRExtDocumentDataRequest.IEestiElukohtType>(Reader, ">>RRExtDocumentDataRequest>EestiElukoht", "http://producers.rr.xtee.riik.ee/producer/rr");
                clazz.EestiElukoht = metaEestiElukoht.NewEntity<RRExtDocumentDataRequest.IEestiElukohtType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("EestiElukoht");
                    metaEestiElukoht.NewSerializer(clazz.EestiElukoht).ReadXml(Reader);
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRExtDocumentDataRequest>EestiElukoht", Reader.LocalName);
            }
            if (Reader.LocalName=="Sideandmed") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRExtDocumentDataRequest>Sideandmed");
                }
                global::Xtee.Core.SerializationMetadata metaSideandmed = this.GetMetaData<RRExtDocumentDataRequest.ISideandmedType>(Reader, ">>RRExtDocumentDataRequest>Sideandmed", "http://producers.rr.xtee.riik.ee/producer/rr");
                clazz.Sideandmed = metaSideandmed.NewEntity<RRExtDocumentDataRequest.ISideandmedType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Sideandmed");
                    metaSideandmed.NewSerializer(clazz.Sideandmed).ReadXml(Reader);
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRExtDocumentDataRequest>Sideandmed", Reader.LocalName);
            }
            if (Reader.LocalName=="Avaldaja") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRExtDocumentDataRequest>Avaldaja");
                }
                global::Xtee.Core.SerializationMetadata metaAvaldaja = this.GetMetaData<RRExtDocumentDataRequest.IAvaldajaType>(Reader, ">>RRExtDocumentDataRequest>Avaldaja", "http://producers.rr.xtee.riik.ee/producer/rr");
                clazz.Avaldaja = metaAvaldaja.NewEntity<RRExtDocumentDataRequest.IAvaldajaType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Avaldaja");
                    metaAvaldaja.NewSerializer(clazz.Avaldaja).ReadXml(Reader);
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRExtDocumentDataRequest>Avaldaja", Reader.LocalName);
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>RRExtDocumentDataRequest>Dokument", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.DokumentType))]
        public class DokumentTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RRExtDocumentDataRequest.IDokumentType clazz;
            
            public DokumentTypeSerializer(RRExtDocumentDataRequest.IDokumentType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("Liik");
                if (clazz.Liik!=null) {
                    global::Xtee.Core.SerializationMetadata metaLiik = this.GetMetaData(clazz.Liik);
                    Writer.WriteTypeAttribute(metaLiik.TypeQualifiedName.Namespace, metaLiik.TypeQualifiedName.Name);
                    metaLiik.NewSerializer(clazz.Liik).WriteXml(Writer);
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Liik");
                }
                Writer.WriteEndElement();
                if (clazz.DokumendiSeeria!=null) {
                    Writer.WriteStartElement("DokumendiSeeria");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiSeeria))).ToString());
                    Writer.WriteEndElement();
                }
                Writer.WriteStartElement("DokumendiNumber");
                if (clazz.DokumendiNumber!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiNumber))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiNumber");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("ValjaandmiseKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.ValjaandmiseKP))).ToString());
                Writer.WriteEndElement();
                Writer.WriteStartElement("JoustumiseKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.JoustumiseKP))).ToString());
                Writer.WriteEndElement();
                Writer.WriteStartElement("KehtivKuniKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.KehtivKuniKP))).ToString());
                Writer.WriteEndElement();
                if (clazz.KehtetuAlatesKP!=null) {
                    Writer.WriteStartElement("KehtetuAlatesKP");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.KehtetuAlatesKP))).ToString());
                    Writer.WriteEndElement();
                }
                Writer.WriteStartElement("KoostanudAsutus");
                if (clazz.KoostanudAsutus!=null) {
                    global::Xtee.Core.SerializationMetadata metaKoostanudAsutus = this.GetMetaData(clazz.KoostanudAsutus);
                    Writer.WriteTypeAttribute(metaKoostanudAsutus.TypeQualifiedName.Namespace, metaKoostanudAsutus.TypeQualifiedName.Name);
                    metaKoostanudAsutus.NewSerializer(clazz.KoostanudAsutus).WriteXml(Writer);
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : KoostanudAsutus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("AmetnikuIsikukood");
                if (clazz.AmetnikuIsikukood!=null) {
                    Writer.WriteTypeAttribute("http://producers.rr.xtee.riik.ee/producer/rr", "PersonalCode");
                    Writer.WriteString(clazz.AmetnikuIsikukood.ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : AmetnikuIsikukood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("AmetnikuNimed");
                if (clazz.AmetnikuNimed!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.AmetnikuNimed))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : AmetnikuNimed");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="Liik") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Dokument>Liik");
                    }
                    global::Xtee.Core.SerializationMetadata metaLiik = this.GetMetaData<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>(Reader, "Kodif", "http://producers.rr.xtee.riik.ee/producer/rr");
                    clazz.Liik = metaLiik.NewEntity<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("Liik");
                        metaLiik.NewSerializer(clazz.Liik).ReadXml(Reader);
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Dokument>Liik", Reader.LocalName);
                }
                if (Reader.LocalName=="DokumendiSeeria") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Dokument>DokumendiSeeria");
                    }
                    clazz.DokumendiSeeria = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("DokumendiSeeria")).Value;
                }
                if (Reader.LocalName=="DokumendiNumber") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Dokument>DokumendiNumber");
                    }
                    clazz.DokumendiNumber = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("DokumendiNumber")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Dokument>DokumendiNumber", Reader.LocalName);
                }
                if (Reader.LocalName=="ValjaandmiseKP") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Dokument>ValjaandmiseKP");
                    }
                    clazz.ValjaandmiseKP = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("ValjaandmiseKP")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Dokument>ValjaandmiseKP", Reader.LocalName);
                }
                if (Reader.LocalName=="JoustumiseKP") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Dokument>JoustumiseKP");
                    }
                    clazz.JoustumiseKP = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("JoustumiseKP")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Dokument>JoustumiseKP", Reader.LocalName);
                }
                if (Reader.LocalName=="KehtivKuniKP") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Dokument>KehtivKuniKP");
                    }
                    clazz.KehtivKuniKP = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("KehtivKuniKP")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Dokument>KehtivKuniKP", Reader.LocalName);
                }
                if (Reader.LocalName=="KehtetuAlatesKP") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Dokument>KehtetuAlatesKP");
                    }
                    clazz.KehtetuAlatesKP = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("KehtetuAlatesKP")).Value;
                }
                if (Reader.LocalName=="KoostanudAsutus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Dokument>KoostanudAsutus");
                    }
                    global::Xtee.Core.SerializationMetadata metaKoostanudAsutus = this.GetMetaData<RRExtDocumentDataRequest.DokumentType.IKoostanudAsutusType>(Reader, ">>>RRExtDocumentDataRequest>Dokument>KoostanudAsutus", "http://producers.rr.xtee.riik.ee/producer/rr");
                    clazz.KoostanudAsutus = metaKoostanudAsutus.NewEntity<RRExtDocumentDataRequest.DokumentType.IKoostanudAsutusType>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("KoostanudAsutus");
                        metaKoostanudAsutus.NewSerializer(clazz.KoostanudAsutus).ReadXml(Reader);
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Dokument>KoostanudAsutus", Reader.LocalName);
                }
                if (Reader.LocalName=="AmetnikuIsikukood") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Dokument>AmetnikuIsikukood");
                    }
                    clazz.AmetnikuIsikukood = new global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.PersonalCode(Reader.ReadElementString("AmetnikuIsikukood"));
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Dokument>AmetnikuIsikukood", Reader.LocalName);
                }
                if (Reader.LocalName=="AmetnikuNimed") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Dokument>AmetnikuNimed");
                    }
                    clazz.AmetnikuNimed = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("AmetnikuNimed")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Dokument>AmetnikuNimed", Reader.LocalName);
                }
            }
            
            [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RRExtDocumentDataRequest>Dokument>KoostanudAsutus", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.DokumentType.KoostanudAsutusType))]
            public class KoostanudAsutusTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
                
                protected RRExtDocumentDataRequest.DokumentType.IKoostanudAsutusType clazz;
                
                public KoostanudAsutusTypeSerializer(RRExtDocumentDataRequest.DokumentType.IKoostanudAsutusType clazz) {
                    this.clazz = clazz;
                }
                
                public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                    base.WriteXml(Writer);
                    Writer.WriteStartElement("Riik");
                    if (clazz.Riik!=null) {
                        global::Xtee.Core.SerializationMetadata metaRiik = this.GetMetaData(clazz.Riik);
                        Writer.WriteTypeAttribute(metaRiik.TypeQualifiedName.Namespace, metaRiik.TypeQualifiedName.Name);
                        metaRiik.NewSerializer(clazz.Riik).WriteXml(Writer);
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Riik");
                    }
                    Writer.WriteEndElement();
                    Writer.WriteStartElement("AsutuseRegNumber");
                    if (clazz.AsutuseRegNumber!=null) {
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.AsutuseRegNumber))).ToString());
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : AsutuseRegNumber");
                    }
                    Writer.WriteEndElement();
                    Writer.WriteStartElement("AsutuseKood");
                    if (clazz.AsutuseKood!=null) {
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.AsutuseKood))).ToString());
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : AsutuseKood");
                    }
                    Writer.WriteEndElement();
                    if (clazz.AsutuseNimi!=null) {
                        Writer.WriteStartElement("AsutuseNimi");
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.AsutuseNimi))).ToString());
                        Writer.WriteEndElement();
                    }
                }
                
                public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                    base.ReadXml(Reader);
                    if (Reader.LocalName=="Riik") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Dokument>KoostanudAsutus>Riik");
                        }
                        global::Xtee.Core.SerializationMetadata metaRiik = this.GetMetaData<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>(Reader, "Kodif", "http://producers.rr.xtee.riik.ee/producer/rr");
                        clazz.Riik = metaRiik.NewEntity<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>();
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Riik");
                            metaRiik.NewSerializer(clazz.Riik).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Dokument>KoostanudAsutus>Riik", Reader.LocalName);
                    }
                    if (Reader.LocalName=="AsutuseRegNumber") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Dokument>KoostanudAsutus>AsutuseRegNumber");
                        }
                        clazz.AsutuseRegNumber = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("AsutuseRegNumber")).Value;
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Dokument>KoostanudAsutus>AsutuseRegNumber", Reader.LocalName);
                    }
                    if (Reader.LocalName=="AsutuseKood") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Dokument>KoostanudAsutus>AsutuseKood");
                        }
                        clazz.AsutuseKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("AsutuseKood")).Value;
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Dokument>KoostanudAsutus>AsutuseKood", Reader.LocalName);
                    }
                    if (Reader.LocalName=="AsutuseNimi") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Dokument>KoostanudAsutus>AsutuseNimi");
                        }
                        clazz.AsutuseNimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("AsutuseNimi")).Value;
                    }
                }
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>RRExtDocumentDataRequest>Isikud", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.IsikudType))]
        public class IsikudTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RRExtDocumentDataRequest.IIsikudType clazz;
            
            public IsikudTypeSerializer(RRExtDocumentDataRequest.IIsikudType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                if (((clazz.Isik == null) 
                            || (clazz.Isik.Count < 1m))) {
                    throw new global::Xtee.Core.Exceptions.MinOccurrenceException(1m, "Isik");
                }
                for (int x = 0; ((clazz.Isik != null) 
                            && (x < clazz.Isik.Count)); x = (x + 1)) {
                    Writer.WriteStartElement("Isik");
                    if (clazz.Isik[x]!=null) {
                        global::Xtee.Core.SerializationMetadata metaIsik = this.GetMetaData(clazz.Isik[x]);
                        Writer.WriteTypeAttribute(metaIsik.TypeQualifiedName.Namespace, metaIsik.TypeQualifiedName.Name);
                        metaIsik.NewSerializer(clazz.Isik[x]).WriteXml(Writer);
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isik");
                    }
                    Writer.WriteEndElement();
                }
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                clazz.Isik = new System.Collections.Generic.List<RRExtDocumentDataRequest.IsikudType.IIsikType>();
                for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                            && (Reader.LocalName == "Isik")); ) {
                    if (Reader.LocalName=="Isik") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Isikud>Isik");
                        }
                        global::Xtee.Core.SerializationMetadata metaIsik = this.GetMetaData<RRExtDocumentDataRequest.IsikudType.IIsikType>(Reader, ">>>RRExtDocumentDataRequest>Isikud>Isik", "http://producers.rr.xtee.riik.ee/producer/rr");
                        RRExtDocumentDataRequest.IsikudType.IIsikType item = metaIsik.NewEntity<RRExtDocumentDataRequest.IsikudType.IIsikType>();
                        clazz.Isik.Add(item);
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Isik");
                            metaIsik.NewSerializer(item).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Isikud>Isik", Reader.LocalName);
                    }
                }
                if ((clazz.Isik.Count < 1m)) {
                    throw new global::Xtee.Core.Exceptions.MinOccurrenceException(1m, "Isik");
                }
            }
            
            [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RRExtDocumentDataRequest>Isikud>Isik", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.IsikudType.IsikType))]
            public class IsikTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
                
                protected RRExtDocumentDataRequest.IsikudType.IIsikType clazz;
                
                public IsikTypeSerializer(RRExtDocumentDataRequest.IsikudType.IIsikType clazz) {
                    this.clazz = clazz;
                }
                
                public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                    base.WriteXml(Writer);
                    Writer.WriteStartElement("Isikukood");
                    if (clazz.Isikukood!=null) {
                        Writer.WriteTypeAttribute("http://producers.rr.xtee.riik.ee/producer/rr", "PersonalCode");
                        Writer.WriteString(clazz.Isikukood.ToString());
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikukood");
                    }
                    Writer.WriteEndElement();
                    Writer.WriteStartElement("ValisriigiIK");
                    if (clazz.ValisriigiIK!=null) {
                        global::Xtee.Core.SerializationMetadata metaValisriigiIK = this.GetMetaData(clazz.ValisriigiIK);
                        Writer.WriteTypeAttribute(metaValisriigiIK.TypeQualifiedName.Namespace, metaValisriigiIK.TypeQualifiedName.Name);
                        metaValisriigiIK.NewSerializer(clazz.ValisriigiIK).WriteXml(Writer);
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ValisriigiIK");
                    }
                    Writer.WriteEndElement();
                    Writer.WriteStartElement("Eesnimi");
                    if (clazz.Eesnimi!=null) {
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Eesnimi))).ToString());
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Eesnimi");
                    }
                    Writer.WriteEndElement();
                    Writer.WriteStartElement("EesnimiRR");
                    if (clazz.EesnimiRR!=null) {
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.EesnimiRR))).ToString());
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : EesnimiRR");
                    }
                    Writer.WriteEndElement();
                    if (clazz.MuudEesnimed!=null) {
                        Writer.WriteStartElement("MuudEesnimed");
                        global::Xtee.Core.SerializationMetadata metaMuudEesnimed = this.GetMetaData(clazz.MuudEesnimed);
                        Writer.WriteTypeAttribute(metaMuudEesnimed.TypeQualifiedName.Namespace, metaMuudEesnimed.TypeQualifiedName.Name);
                        metaMuudEesnimed.NewSerializer(clazz.MuudEesnimed).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                    Writer.WriteStartElement("Perenimi");
                    if (clazz.Perenimi!=null) {
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Perenimi))).ToString());
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Perenimi");
                    }
                    Writer.WriteEndElement();
                    Writer.WriteStartElement("PerenimiRR");
                    if (clazz.PerenimiRR!=null) {
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PerenimiRR))).ToString());
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PerenimiRR");
                    }
                    Writer.WriteEndElement();
                    if (clazz.MuudPerenimed!=null) {
                        Writer.WriteStartElement("MuudPerenimed");
                        global::Xtee.Core.SerializationMetadata metaMuudPerenimed = this.GetMetaData(clazz.MuudPerenimed);
                        Writer.WriteTypeAttribute(metaMuudPerenimed.TypeQualifiedName.Namespace, metaMuudPerenimed.TypeQualifiedName.Name);
                        metaMuudPerenimed.NewSerializer(clazz.MuudPerenimed).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                    if (clazz.PohiKodakondsus!=null) {
                        Writer.WriteStartElement("PohiKodakondsus");
                        global::Xtee.Core.SerializationMetadata metaPohiKodakondsus = this.GetMetaData(clazz.PohiKodakondsus);
                        Writer.WriteTypeAttribute(metaPohiKodakondsus.TypeQualifiedName.Namespace, metaPohiKodakondsus.TypeQualifiedName.Name);
                        metaPohiKodakondsus.NewSerializer(clazz.PohiKodakondsus).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                    if (clazz.Kodakondsused!=null) {
                        Writer.WriteStartElement("Kodakondsused");
                        global::Xtee.Core.SerializationMetadata metaKodakondsused = this.GetMetaData(clazz.Kodakondsused);
                        Writer.WriteTypeAttribute(metaKodakondsused.TypeQualifiedName.Namespace, metaKodakondsused.TypeQualifiedName.Name);
                        metaKodakondsused.NewSerializer(clazz.Kodakondsused).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                    if (clazz.Lisainfo!=null) {
                        Writer.WriteStartElement("Lisainfo");
                        global::Xtee.Core.SerializationMetadata metaLisainfo = this.GetMetaData(clazz.Lisainfo);
                        Writer.WriteTypeAttribute(metaLisainfo.TypeQualifiedName.Namespace, metaLisainfo.TypeQualifiedName.Name);
                        metaLisainfo.NewSerializer(clazz.Lisainfo).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
                
                public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                    base.ReadXml(Reader);
                    if (Reader.LocalName=="Isikukood") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Isikud>Isik>Isikukood");
                        }
                        clazz.Isikukood = new global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.PersonalCode(Reader.ReadElementString("Isikukood"));
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Isikud>Isik>Isikukood", Reader.LocalName);
                    }
                    if (Reader.LocalName=="ValisriigiIK") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Isikud>Isik>ValisriigiIK");
                        }
                        global::Xtee.Core.SerializationMetadata metaValisriigiIK = this.GetMetaData<RRExtDocumentDataRequest.IsikudType.IsikType.IValisriigiIKType>(Reader, ">>>>RRExtDocumentDataRequest>Isikud>Isik>ValisriigiIK", "http://producers.rr.xtee.riik.ee/producer/rr");
                        clazz.ValisriigiIK = metaValisriigiIK.NewEntity<RRExtDocumentDataRequest.IsikudType.IsikType.IValisriigiIKType>();
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("ValisriigiIK");
                            metaValisriigiIK.NewSerializer(clazz.ValisriigiIK).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Isikud>Isik>ValisriigiIK", Reader.LocalName);
                    }
                    if (Reader.LocalName=="Eesnimi") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Isikud>Isik>Eesnimi");
                        }
                        clazz.Eesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Eesnimi")).Value;
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Isikud>Isik>Eesnimi", Reader.LocalName);
                    }
                    if (Reader.LocalName=="EesnimiRR") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Isikud>Isik>EesnimiRR");
                        }
                        clazz.EesnimiRR = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("EesnimiRR")).Value;
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Isikud>Isik>EesnimiRR", Reader.LocalName);
                    }
                    if (Reader.LocalName=="MuudEesnimed") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Isikud>Isik>MuudEesnimed");
                        }
                        global::Xtee.Core.SerializationMetadata metaMuudEesnimed = this.GetMetaData<RRExtDocumentDataRequest.IsikudType.IsikType.IMuudEesnimedType>(Reader, ">>>>RRExtDocumentDataRequest>Isikud>Isik>MuudEesnimed", "http://producers.rr.xtee.riik.ee/producer/rr");
                        clazz.MuudEesnimed = metaMuudEesnimed.NewEntity<RRExtDocumentDataRequest.IsikudType.IsikType.IMuudEesnimedType>();
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("MuudEesnimed");
                            metaMuudEesnimed.NewSerializer(clazz.MuudEesnimed).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    if (Reader.LocalName=="Perenimi") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Isikud>Isik>Perenimi");
                        }
                        clazz.Perenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Perenimi")).Value;
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Isikud>Isik>Perenimi", Reader.LocalName);
                    }
                    if (Reader.LocalName=="PerenimiRR") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Isikud>Isik>PerenimiRR");
                        }
                        clazz.PerenimiRR = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("PerenimiRR")).Value;
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Isikud>Isik>PerenimiRR", Reader.LocalName);
                    }
                    if (Reader.LocalName=="MuudPerenimed") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Isikud>Isik>MuudPerenimed");
                        }
                        global::Xtee.Core.SerializationMetadata metaMuudPerenimed = this.GetMetaData<RRExtDocumentDataRequest.IsikudType.IsikType.IMuudPerenimedType>(Reader, ">>>>RRExtDocumentDataRequest>Isikud>Isik>MuudPerenimed", "http://producers.rr.xtee.riik.ee/producer/rr");
                        clazz.MuudPerenimed = metaMuudPerenimed.NewEntity<RRExtDocumentDataRequest.IsikudType.IsikType.IMuudPerenimedType>();
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("MuudPerenimed");
                            metaMuudPerenimed.NewSerializer(clazz.MuudPerenimed).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    if (Reader.LocalName=="PohiKodakondsus") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Isikud>Isik>PohiKodakondsus");
                        }
                        global::Xtee.Core.SerializationMetadata metaPohiKodakondsus = this.GetMetaData<RRExtDocumentDataRequest.IsikudType.IsikType.IPohiKodakondsusType>(Reader, ">>>>RRExtDocumentDataRequest>Isikud>Isik>PohiKodakondsus", "http://producers.rr.xtee.riik.ee/producer/rr");
                        clazz.PohiKodakondsus = metaPohiKodakondsus.NewEntity<RRExtDocumentDataRequest.IsikudType.IsikType.IPohiKodakondsusType>();
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("PohiKodakondsus");
                            metaPohiKodakondsus.NewSerializer(clazz.PohiKodakondsus).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    if (Reader.LocalName=="Kodakondsused") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Isikud>Isik>Kodakondsused");
                        }
                        global::Xtee.Core.SerializationMetadata metaKodakondsused = this.GetMetaData<RRExtDocumentDataRequest.IsikudType.IsikType.IKodakondsusedType>(Reader, ">>>>RRExtDocumentDataRequest>Isikud>Isik>Kodakondsused", "http://producers.rr.xtee.riik.ee/producer/rr");
                        clazz.Kodakondsused = metaKodakondsused.NewEntity<RRExtDocumentDataRequest.IsikudType.IsikType.IKodakondsusedType>();
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Kodakondsused");
                            metaKodakondsused.NewSerializer(clazz.Kodakondsused).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    if (Reader.LocalName=="Lisainfo") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Isikud>Isik>Lisainfo");
                        }
                        global::Xtee.Core.SerializationMetadata metaLisainfo = this.GetMetaData<RRExtDocumentDataRequest.IsikudType.IsikType.ILisainfoType>(Reader, ">>>>RRExtDocumentDataRequest>Isikud>Isik>Lisainfo", "http://producers.rr.xtee.riik.ee/producer/rr");
                        clazz.Lisainfo = metaLisainfo.NewEntity<RRExtDocumentDataRequest.IsikudType.IsikType.ILisainfoType>();
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Lisainfo");
                            metaLisainfo.NewSerializer(clazz.Lisainfo).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                }
                
                [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>>RRExtDocumentDataRequest>Isikud>Isik>ValisriigiIK", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.IsikudType.IsikType.ValisriigiIKType))]
                public class ValisriigiIKTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
                    
                    protected RRExtDocumentDataRequest.IsikudType.IsikType.IValisriigiIKType clazz;
                    
                    public ValisriigiIKTypeSerializer(RRExtDocumentDataRequest.IsikudType.IsikType.IValisriigiIKType clazz) {
                        this.clazz = clazz;
                    }
                    
                    public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                        base.WriteXml(Writer);
                        Writer.WriteStartElement("Riik");
                        if (clazz.Riik!=null) {
                            global::Xtee.Core.SerializationMetadata metaRiik = this.GetMetaData(clazz.Riik);
                            Writer.WriteTypeAttribute(metaRiik.TypeQualifiedName.Namespace, metaRiik.TypeQualifiedName.Name);
                            metaRiik.NewSerializer(clazz.Riik).WriteXml(Writer);
                        }
                        else {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Riik");
                        }
                        Writer.WriteEndElement();
                        Writer.WriteStartElement("ValisriigiIK");
                        if (clazz.ValisriigiIK!=null) {
                            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                            Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.ValisriigiIK))).ToString());
                        }
                        else {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : ValisriigiIK");
                        }
                        Writer.WriteEndElement();
                    }
                    
                    public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                        base.ReadXml(Reader);
                        if (Reader.LocalName=="Riik") {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>ValisriigiIK>Riik");
                            }
                            global::Xtee.Core.SerializationMetadata metaRiik = this.GetMetaData<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>(Reader, "Kodif", "http://producers.rr.xtee.riik.ee/producer/rr");
                            clazz.Riik = metaRiik.NewEntity<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>();
                            if ((Reader.IsEmptyElement == false)) {
                                Reader.ReadStartElement("Riik");
                                metaRiik.NewSerializer(clazz.Riik).ReadXml(Reader);
                                Reader.ReadEndElement();
                            }
                            else {
                                Reader.Skip();
                            }
                        }
                        else {
                            throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>ValisriigiIK>Riik", Reader.LocalName);
                        }
                        if (Reader.LocalName=="ValisriigiIK") {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>ValisriigiIK>ValisriigiIK");
                            }
                            clazz.ValisriigiIK = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("ValisriigiIK")).Value;
                        }
                        else {
                            throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>ValisriigiIK>ValisriigiIK", Reader.LocalName);
                        }
                    }
                }
                
                [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>>RRExtDocumentDataRequest>Isikud>Isik>MuudEesnimed", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.IsikudType.IsikType.MuudEesnimedType))]
                public class MuudEesnimedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
                    
                    protected RRExtDocumentDataRequest.IsikudType.IsikType.IMuudEesnimedType clazz;
                    
                    public MuudEesnimedTypeSerializer(RRExtDocumentDataRequest.IsikudType.IsikType.IMuudEesnimedType clazz) {
                        this.clazz = clazz;
                    }
                    
                    public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                        base.WriteXml(Writer);
                        Writer.WriteStartElement("MuuEesnimi");
                        if (clazz.MuuEesnimi!=null) {
                            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                            Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MuuEesnimi))).ToString());
                        }
                        else {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : MuuEesnimi");
                        }
                        Writer.WriteEndElement();
                    }
                    
                    public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                        base.ReadXml(Reader);
                        if (Reader.LocalName=="MuuEesnimi") {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>MuudEesnimed>MuuEesnimi");
                            }
                            clazz.MuuEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MuuEesnimi")).Value;
                        }
                        else {
                            throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>MuudEesnimed>MuuEesnimi", Reader.LocalName);
                        }
                    }
                }
                
                [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>>RRExtDocumentDataRequest>Isikud>Isik>MuudPerenimed", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.IsikudType.IsikType.MuudPerenimedType))]
                public class MuudPerenimedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
                    
                    protected RRExtDocumentDataRequest.IsikudType.IsikType.IMuudPerenimedType clazz;
                    
                    public MuudPerenimedTypeSerializer(RRExtDocumentDataRequest.IsikudType.IsikType.IMuudPerenimedType clazz) {
                        this.clazz = clazz;
                    }
                    
                    public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                        base.WriteXml(Writer);
                        Writer.WriteStartElement("MuuPerenimi");
                        if (clazz.MuuPerenimi!=null) {
                            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                            Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MuuPerenimi))).ToString());
                        }
                        else {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : MuuPerenimi");
                        }
                        Writer.WriteEndElement();
                    }
                    
                    public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                        base.ReadXml(Reader);
                        if (Reader.LocalName=="MuuPerenimi") {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>MuudPerenimed>MuuPerenimi");
                            }
                            clazz.MuuPerenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MuuPerenimi")).Value;
                        }
                        else {
                            throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>MuudPerenimed>MuuPerenimi", Reader.LocalName);
                        }
                    }
                }
                
                [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>>RRExtDocumentDataRequest>Isikud>Isik>PohiKodakondsus", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.IsikudType.IsikType.PohiKodakondsusType))]
                public class PohiKodakondsusTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
                    
                    protected RRExtDocumentDataRequest.IsikudType.IsikType.IPohiKodakondsusType clazz;
                    
                    public PohiKodakondsusTypeSerializer(RRExtDocumentDataRequest.IsikudType.IsikType.IPohiKodakondsusType clazz) {
                        this.clazz = clazz;
                    }
                    
                    public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                        base.WriteXml(Writer);
                        Writer.WriteStartElement("Riik");
                        if (clazz.Riik!=null) {
                            global::Xtee.Core.SerializationMetadata metaRiik = this.GetMetaData(clazz.Riik);
                            Writer.WriteTypeAttribute(metaRiik.TypeQualifiedName.Namespace, metaRiik.TypeQualifiedName.Name);
                            metaRiik.NewSerializer(clazz.Riik).WriteXml(Writer);
                        }
                        else {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Riik");
                        }
                        Writer.WriteEndElement();
                    }
                    
                    public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                        base.ReadXml(Reader);
                        if (Reader.LocalName=="Riik") {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>PohiKodakondsus>Riik");
                            }
                            global::Xtee.Core.SerializationMetadata metaRiik = this.GetMetaData<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>(Reader, "Kodif", "http://producers.rr.xtee.riik.ee/producer/rr");
                            clazz.Riik = metaRiik.NewEntity<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>();
                            if ((Reader.IsEmptyElement == false)) {
                                Reader.ReadStartElement("Riik");
                                metaRiik.NewSerializer(clazz.Riik).ReadXml(Reader);
                                Reader.ReadEndElement();
                            }
                            else {
                                Reader.Skip();
                            }
                        }
                        else {
                            throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>PohiKodakondsus>Riik", Reader.LocalName);
                        }
                    }
                }
                
                [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>>RRExtDocumentDataRequest>Isikud>Isik>Kodakondsused", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.IsikudType.IsikType.KodakondsusedType))]
                public class KodakondsusedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
                    
                    protected RRExtDocumentDataRequest.IsikudType.IsikType.IKodakondsusedType clazz;
                    
                    public KodakondsusedTypeSerializer(RRExtDocumentDataRequest.IsikudType.IsikType.IKodakondsusedType clazz) {
                        this.clazz = clazz;
                    }
                    
                    public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                        base.WriteXml(Writer);
                        if (((clazz.Riik == null) 
                                    || (clazz.Riik.Count < 1m))) {
                            throw new global::Xtee.Core.Exceptions.MinOccurrenceException(1m, "Riik");
                        }
                        for (int x = 0; ((clazz.Riik != null) 
                                    && (x < clazz.Riik.Count)); x = (x + 1)) {
                            Writer.WriteStartElement("Riik");
                            if (clazz.Riik[x]!=null) {
                                global::Xtee.Core.SerializationMetadata metaRiik = this.GetMetaData(clazz.Riik[x]);
                                Writer.WriteTypeAttribute(metaRiik.TypeQualifiedName.Namespace, metaRiik.TypeQualifiedName.Name);
                                metaRiik.NewSerializer(clazz.Riik[x]).WriteXml(Writer);
                            }
                            else {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Riik");
                            }
                            Writer.WriteEndElement();
                        }
                    }
                    
                    public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                        base.ReadXml(Reader);
                        clazz.Riik = new System.Collections.Generic.List<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>();
                        for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                    && (Reader.LocalName == "Riik")); ) {
                            if (Reader.LocalName=="Riik") {
                                if (Reader.IsElementNil()) {
                                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>Kodakondsused>Riik");
                                }
                                global::Xtee.Core.SerializationMetadata metaRiik = this.GetMetaData<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>(Reader, "Kodif", "http://producers.rr.xtee.riik.ee/producer/rr");
                                global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif item = metaRiik.NewEntity<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>();
                                clazz.Riik.Add(item);
                                if ((Reader.IsEmptyElement == false)) {
                                    Reader.ReadStartElement("Riik");
                                    metaRiik.NewSerializer(item).ReadXml(Reader);
                                    Reader.ReadEndElement();
                                }
                                else {
                                    Reader.Skip();
                                }
                            }
                            else {
                                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>Kodakondsused>Riik", Reader.LocalName);
                            }
                        }
                        if ((clazz.Riik.Count < 1m)) {
                            throw new global::Xtee.Core.Exceptions.MinOccurrenceException(1m, "Riik");
                        }
                    }
                }
                
                [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>>RRExtDocumentDataRequest>Isikud>Isik>Lisainfo", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.IsikudType.IsikType.LisainfoType))]
                public class LisainfoTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
                    
                    protected RRExtDocumentDataRequest.IsikudType.IsikType.ILisainfoType clazz;
                    
                    public LisainfoTypeSerializer(RRExtDocumentDataRequest.IsikudType.IsikType.ILisainfoType clazz) {
                        this.clazz = clazz;
                    }
                    
                    public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                        base.WriteXml(Writer);
                        if (clazz.Synnikoht!=null) {
                            Writer.WriteStartElement("Synnikoht");
                            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                            Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Synnikoht))).ToString());
                            Writer.WriteEndElement();
                        }
                        if (clazz.Synniaeg!=null) {
                            Writer.WriteStartElement("Synniaeg");
                            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
                            Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.Synniaeg))).ToString());
                            Writer.WriteEndElement();
                        }
                        if (clazz.Sugu!=null) {
                            Writer.WriteStartElement("Sugu");
                            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                            Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Sugu))).ToString());
                            Writer.WriteEndElement();
                        }
                    }
                    
                    public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                        base.ReadXml(Reader);
                        if (Reader.LocalName=="Synnikoht") {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>Lisainfo>Synnikoht");
                            }
                            clazz.Synnikoht = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Synnikoht")).Value;
                        }
                        if (Reader.LocalName=="Synniaeg") {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>Lisainfo>Synniaeg");
                            }
                            clazz.Synniaeg = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("Synniaeg")).Value;
                        }
                        if (Reader.LocalName=="Sugu") {
                            if (Reader.IsElementNil()) {
                                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>>RRExtDocumentDataRequest>Isikud>Isik>Lisainfo>Sugu");
                            }
                            clazz.Sugu = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Sugu")).Value;
                        }
                    }
                }
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>RRExtDocumentDataRequest>Elukoht", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.ElukohtType))]
        public class ElukohtTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RRExtDocumentDataRequest.IElukohtType clazz;
            
            public ElukohtTypeSerializer(RRExtDocumentDataRequest.IElukohtType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("RiigiKood");
                if (clazz.RiigiKood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.RiigiKood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : RiigiKood");
                }
                Writer.WriteEndElement();
                if (clazz.Tase1!=null) {
                    Writer.WriteStartElement("Tase1");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Tase1))).ToString());
                    Writer.WriteEndElement();
                }
                if (clazz.Tase2!=null) {
                    Writer.WriteStartElement("Tase2");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Tase2))).ToString());
                    Writer.WriteEndElement();
                }
                if (clazz.Tase3!=null) {
                    Writer.WriteStartElement("Tase3");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Tase3))).ToString());
                    Writer.WriteEndElement();
                }
                if (clazz.Tase4!=null) {
                    Writer.WriteStartElement("Tase4");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Tase4))).ToString());
                    Writer.WriteEndElement();
                }
                if (clazz.Tase5!=null) {
                    Writer.WriteStartElement("Tase5");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Tase5))).ToString());
                    Writer.WriteEndElement();
                }
                if (clazz.Tase6!=null) {
                    Writer.WriteStartElement("Tase6");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Tase6))).ToString());
                    Writer.WriteEndElement();
                }
                if (clazz.Tase7!=null) {
                    Writer.WriteStartElement("Tase7");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Tase7))).ToString());
                    Writer.WriteEndElement();
                }
                if (clazz.Tase8!=null) {
                    Writer.WriteStartElement("Tase8");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Tase8))).ToString());
                    Writer.WriteEndElement();
                }
                if (clazz.PostiIndeks!=null) {
                    Writer.WriteStartElement("PostiIndeks");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PostiIndeks))).ToString());
                    Writer.WriteEndElement();
                }
                if (clazz.AlgusKP!=null) {
                    Writer.WriteStartElement("AlgusKP");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.AlgusKP))).ToString());
                    Writer.WriteEndElement();
                }
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="RiigiKood") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Elukoht>RiigiKood");
                    }
                    clazz.RiigiKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("RiigiKood")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Elukoht>RiigiKood", Reader.LocalName);
                }
                if (Reader.LocalName=="Tase1") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Elukoht>Tase1");
                    }
                    clazz.Tase1 = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Tase1")).Value;
                }
                if (Reader.LocalName=="Tase2") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Elukoht>Tase2");
                    }
                    clazz.Tase2 = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Tase2")).Value;
                }
                if (Reader.LocalName=="Tase3") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Elukoht>Tase3");
                    }
                    clazz.Tase3 = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Tase3")).Value;
                }
                if (Reader.LocalName=="Tase4") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Elukoht>Tase4");
                    }
                    clazz.Tase4 = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Tase4")).Value;
                }
                if (Reader.LocalName=="Tase5") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Elukoht>Tase5");
                    }
                    clazz.Tase5 = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Tase5")).Value;
                }
                if (Reader.LocalName=="Tase6") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Elukoht>Tase6");
                    }
                    clazz.Tase6 = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Tase6")).Value;
                }
                if (Reader.LocalName=="Tase7") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Elukoht>Tase7");
                    }
                    clazz.Tase7 = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Tase7")).Value;
                }
                if (Reader.LocalName=="Tase8") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Elukoht>Tase8");
                    }
                    clazz.Tase8 = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Tase8")).Value;
                }
                if (Reader.LocalName=="PostiIndeks") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Elukoht>PostiIndeks");
                    }
                    clazz.PostiIndeks = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("PostiIndeks")).Value;
                }
                if (Reader.LocalName=="AlgusKP") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Elukoht>AlgusKP");
                    }
                    clazz.AlgusKP = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("AlgusKP")).Value;
                }
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>RRExtDocumentDataRequest>EestiElukoht", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.EestiElukohtType))]
        public class EestiElukohtTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RRExtDocumentDataRequest.IEestiElukohtType clazz;
            
            public EestiElukohtTypeSerializer(RRExtDocumentDataRequest.IEestiElukohtType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("Tase1");
                if (clazz.Tase1!=null) {
                    global::Xtee.Core.SerializationMetadata metaTase1 = this.GetMetaData(clazz.Tase1);
                    Writer.WriteTypeAttribute(metaTase1.TypeQualifiedName.Namespace, metaTase1.TypeQualifiedName.Name);
                    metaTase1.NewSerializer(clazz.Tase1).WriteXml(Writer);
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Tase1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Tase2");
                if (clazz.Tase2!=null) {
                    global::Xtee.Core.SerializationMetadata metaTase2 = this.GetMetaData(clazz.Tase2);
                    Writer.WriteTypeAttribute(metaTase2.TypeQualifiedName.Namespace, metaTase2.TypeQualifiedName.Name);
                    metaTase2.NewSerializer(clazz.Tase2).WriteXml(Writer);
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Tase2");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Tase3");
                if (clazz.Tase3!=null) {
                    global::Xtee.Core.SerializationMetadata metaTase3 = this.GetMetaData(clazz.Tase3);
                    Writer.WriteTypeAttribute(metaTase3.TypeQualifiedName.Namespace, metaTase3.TypeQualifiedName.Name);
                    metaTase3.NewSerializer(clazz.Tase3).WriteXml(Writer);
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Tase3");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="Tase1") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>EestiElukoht>Tase1");
                    }
                    global::Xtee.Core.SerializationMetadata metaTase1 = this.GetMetaData<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>(Reader, "Kodif", "http://producers.rr.xtee.riik.ee/producer/rr");
                    clazz.Tase1 = metaTase1.NewEntity<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("Tase1");
                        metaTase1.NewSerializer(clazz.Tase1).ReadXml(Reader);
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>EestiElukoht>Tase1", Reader.LocalName);
                }
                if (Reader.LocalName=="Tase2") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>EestiElukoht>Tase2");
                    }
                    global::Xtee.Core.SerializationMetadata metaTase2 = this.GetMetaData<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>(Reader, "Kodif", "http://producers.rr.xtee.riik.ee/producer/rr");
                    clazz.Tase2 = metaTase2.NewEntity<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("Tase2");
                        metaTase2.NewSerializer(clazz.Tase2).ReadXml(Reader);
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>EestiElukoht>Tase2", Reader.LocalName);
                }
                if (Reader.LocalName=="Tase3") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>EestiElukoht>Tase3");
                    }
                    global::Xtee.Core.SerializationMetadata metaTase3 = this.GetMetaData<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>(Reader, "Kodif", "http://producers.rr.xtee.riik.ee/producer/rr");
                    clazz.Tase3 = metaTase3.NewEntity<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("Tase3");
                        metaTase3.NewSerializer(clazz.Tase3).ReadXml(Reader);
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>EestiElukoht>Tase3", Reader.LocalName);
                }
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>RRExtDocumentDataRequest>Sideandmed", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.SideandmedType))]
        public class SideandmedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RRExtDocumentDataRequest.ISideandmedType clazz;
            
            public SideandmedTypeSerializer(RRExtDocumentDataRequest.ISideandmedType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("Kontakt");
                if (clazz.Kontakt!=null) {
                    global::Xtee.Core.SerializationMetadata metaKontakt = this.GetMetaData(clazz.Kontakt);
                    Writer.WriteTypeAttribute(metaKontakt.TypeQualifiedName.Namespace, metaKontakt.TypeQualifiedName.Name);
                    metaKontakt.NewSerializer(clazz.Kontakt).WriteXml(Writer);
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Kontakt");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="Kontakt") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Sideandmed>Kontakt");
                    }
                    global::Xtee.Core.SerializationMetadata metaKontakt = this.GetMetaData<RRExtDocumentDataRequest.SideandmedType.IKontaktType>(Reader, ">>>RRExtDocumentDataRequest>Sideandmed>Kontakt", "http://producers.rr.xtee.riik.ee/producer/rr");
                    clazz.Kontakt = metaKontakt.NewEntity<RRExtDocumentDataRequest.SideandmedType.IKontaktType>();
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("Kontakt");
                        metaKontakt.NewSerializer(clazz.Kontakt).ReadXml(Reader);
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Sideandmed>Kontakt", Reader.LocalName);
                }
            }
            
            [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RRExtDocumentDataRequest>Sideandmed>Kontakt", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.SideandmedType.KontaktType))]
            public class KontaktTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
                
                protected RRExtDocumentDataRequest.SideandmedType.IKontaktType clazz;
                
                public KontaktTypeSerializer(RRExtDocumentDataRequest.SideandmedType.IKontaktType clazz) {
                    this.clazz = clazz;
                }
                
                public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                    base.WriteXml(Writer);
                    Writer.WriteStartElement("Liik");
                    if (clazz.Liik!=null) {
                        global::Xtee.Core.SerializationMetadata metaLiik = this.GetMetaData(clazz.Liik);
                        Writer.WriteTypeAttribute(metaLiik.TypeQualifiedName.Namespace, metaLiik.TypeQualifiedName.Name);
                        metaLiik.NewSerializer(clazz.Liik).WriteXml(Writer);
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Liik");
                    }
                    Writer.WriteEndElement();
                    Writer.WriteStartElement("KontaktiTekst");
                    if (clazz.KontaktiTekst!=null) {
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.KontaktiTekst))).ToString());
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : KontaktiTekst");
                    }
                    Writer.WriteEndElement();
                    Writer.WriteStartElement("AlatesKP");
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.AlatesKP))).ToString());
                    Writer.WriteEndElement();
                    if (clazz.KuniKP!=null) {
                        Writer.WriteStartElement("KuniKP");
                        Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
                        Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.KuniKP))).ToString());
                        Writer.WriteEndElement();
                    }
                }
                
                public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                    base.ReadXml(Reader);
                    if (Reader.LocalName=="Liik") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Sideandmed>Kontakt>Liik");
                        }
                        global::Xtee.Core.SerializationMetadata metaLiik = this.GetMetaData<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>(Reader, "Kodif", "http://producers.rr.xtee.riik.ee/producer/rr");
                        clazz.Liik = metaLiik.NewEntity<global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.IKodif>();
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Liik");
                            metaLiik.NewSerializer(clazz.Liik).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Sideandmed>Kontakt>Liik", Reader.LocalName);
                    }
                    if (Reader.LocalName=="KontaktiTekst") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Sideandmed>Kontakt>KontaktiTekst");
                        }
                        clazz.KontaktiTekst = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("KontaktiTekst")).Value;
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Sideandmed>Kontakt>KontaktiTekst", Reader.LocalName);
                    }
                    if (Reader.LocalName=="AlatesKP") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Sideandmed>Kontakt>AlatesKP");
                        }
                        clazz.AlatesKP = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("AlatesKP")).Value;
                    }
                    else {
                        throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RRExtDocumentDataRequest>Sideandmed>Kontakt>AlatesKP", Reader.LocalName);
                    }
                    if (Reader.LocalName=="KuniKP") {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RRExtDocumentDataRequest>Sideandmed>Kontakt>KuniKP");
                        }
                        clazz.KuniKP = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("KuniKP")).Value;
                    }
                }
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>RRExtDocumentDataRequest>Avaldaja", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRExtDocumentDataRequest.AvaldajaType))]
        public class AvaldajaTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RRExtDocumentDataRequest.IAvaldajaType clazz;
            
            public AvaldajaTypeSerializer(RRExtDocumentDataRequest.IAvaldajaType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("Isikukood");
                if (clazz.Isikukood!=null) {
                    Writer.WriteTypeAttribute("http://producers.rr.xtee.riik.ee/producer/rr", "PersonalCode");
                    Writer.WriteString(clazz.Isikukood.ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikukood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Eesnimi");
                if (clazz.Eesnimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Eesnimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Eesnimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Perenimi");
                if (clazz.Perenimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Perenimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Perenimi");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="Isikukood") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Avaldaja>Isikukood");
                    }
                    clazz.Isikukood = new global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.PersonalCode(Reader.ReadElementString("Isikukood"));
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Avaldaja>Isikukood", Reader.LocalName);
                }
                if (Reader.LocalName=="Eesnimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Avaldaja>Eesnimi");
                    }
                    clazz.Eesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Eesnimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Avaldaja>Eesnimi", Reader.LocalName);
                }
                if (Reader.LocalName=="Perenimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RRExtDocumentDataRequest>Avaldaja>Perenimi");
                    }
                    clazz.Perenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Perenimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>RRExtDocumentDataRequest>Avaldaja>Perenimi", Reader.LocalName);
                }
            }
        }
    }
}
